app_family.controller("controller_orderstoresel", function($scope, $rootScope, httpRequest, $location) {
	$rootScope.$broadcast('currentModule', 'page_orderlist');
	$rootScope.$broadcast('footerFlag', false); // 是否显示底部导航
	$scope.imagebasepath = imagebasepath; // 资源图片根目录
	
	data_sessionStorage = JSON.parse(sessionStorage.getItem('data_sessionStorage'));
	
	/**
	 * 判断是否用手机登录过
	 */
	if (data_sessionStorage) {
		var familyPhone = data_sessionStorage.familyInfo.phone;
		if (familyPhone == '' || familyPhone == null) {
			window.location.replace(basepath + 'login.html');
			return;
		}
	} else {
		window.location.replace(basepath + 'login.html');
		return;
	}
	
	/**
	 * 获取基本信息
	 */
	httpRequest.getOlderInfo({
		account : data_sessionStorage.order_service.older.account
	}, function (data) {
		if (data.success === true) {
			$scope.olderInfoObj = data.obj;
		} else if (data.success === false) {
			$.dialog.showToast({msgTxt : data.msg});
		}
	});
	
	/**
	 * 查询服务商列表
	 */
	$scope.order_serviceObj = data_sessionStorage.order_service;
	httpRequest.getSupplierAndPrice({
		lon : data_sessionStorage.order_service.older.lon,
		lat : data_sessionStorage.order_service.older.lat,
		service_code : data_sessionStorage.order_service.service.code
	}, function (data) {
		if (data.success === true) {
			$scope.storeList = data.obj;
		} else if (data.success === false) {
			$.dialog.showToast({msgTxt : data.msg});
		}
	});
	
	/**
	 * 去选服务商
	 */
	$scope.selStore = function (code, name, price) {
		// 保存选的服务商
		data_sessionStorage.order_service.supplier.code = code;
		data_sessionStorage.order_service.supplier.name = name;
		data_sessionStorage.order_service.supplier.price = price;
		sessionStorage.setItem('data_sessionStorage', JSON.stringify(data_sessionStorage));
		// 页面跳转
		$location.path('/orderconfirm');
		$scope.$apply();
	};
});